package yuxi3;

//字符串反转  StringBuilder转换为String

import java.util.Scanner;

public class StringBuilderDem05 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个字符串:");
        String line = sc.nextLine();

        String s = reverse(line);
        System.out.println(s);

    }
    public static String reverse(String line){
        //用Stringbuilder实现字符串反转，并把结果转成String返回
        //String ----StringBuilder----reverse()-----String
        StringBuilder sb = new StringBuilder(line);
        sb.reverse();
        String ss  =sb.toString();
        return ss;
    }
}
